extends Node3D

@onready var beam: MeshInstance3D = $beam
@onready var laser_cast: RayCast3D = $laser_cast

func _ready() -> void:
	pass

func _process(delta: float) -> void:
	if laser_cast.is_colliding():
		var point = laser_cast.get_collision_point()
		var distance = (point - global_position).length()
		beam.mesh.height = distance
		beam.position.z = to_local(point).z/2
